package com.acoreful.bootsample.dms.web.controller;

import java.util.Arrays;
import java.util.List;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.acoreful.bootsample.dms.model.ResponseData;

@RestController
@RequestMapping("upload")
public class UploadController {
	
	@PostMapping
	public ResponseData upload(@RequestParam(value = "file", required = false) MultipartFile[] files) {
		if (files == null) {
			return new ResponseData();
		}
		List<MultipartFile> fileList = Arrays.asList(files);
		fileList.forEach(f -> {
			System.out.println(f.getOriginalFilename());
		});
		return new ResponseData();
	}
}